<!doctype html>

    <%@ include file="header_inc.jsp" %>
	<div id="content">
	<div id="mood" class="sec">
	<h3>Latest Mood:</h3>
	<div id="mood-div" class="section">
		<div id="mood-display-div">
			<%
				MoodDao moodDao = new MoodDao();
				List<Mood> moods = moodDao.listLatestMoods(3);
				for (Mood mood : moods) {
			%>
			<img
				src="<%=ImageUtils.getMoodImageUrls(mood.getMoods()
						.getCategory())%>" />
			&nbsp;
			<%=mood.getMoodMessage() %> &nbsp; <time datetime=<%=DateUtils.parseDate(mood.getModifiedDate())%>></time>
						 <br>
			<%
				}
			%>
			<a href="listAllMoods.jsp">List all moods</a>
		</div>
		<%
			if (UserIdentificationService.isAdminLoggedIn()) {
		%>
		<form action="/moodUpdateServlet?action=new" method="post">
			<select name="moods-option" size="1">
				<option value="happy">happy</option>
				<option value="soso">soso</option>
				<option value="unhappy">unhappy</option>
			</select>
			<div id="mood-update-div">
				<textarea id="mood-content-id" name="mood-content" rows="3"
					cols="60"></textarea>
				<input type="submit" value="update moods" />
			</div>
		</form>
		<%
			}
		%>
	</div>
	</div>
	<div id="news" class="sec">
	<h3>Latest News:</h3>
	<div id="news-div" class="section">
		<div id="news-display-div">
			<%
				NewsDao newsDao = new NewsDao();
				List<News> newsList = newsDao.listLatestNews(3);
				for (News news : newsList) {
			%>
			<%=news.getNewsContent().getValue()
						+ DateUtils.parseDate(news.getModifiedDate())%><br>
			<%
				}
			%>
			<a href="listAllNews.jsp">List all news</a>
		</div>
		<%
			if (UserIdentificationService.isAdminLoggedIn()) {
		%>
		<form action="/newsUpdateServlet?action=new" method="post">
			<div id="news-update-div">
				<textarea id="news-content-id" name="news-content" rows="3"
					cols="60"></textarea>
				<script type="text/javascript">
					CKEDITOR.replace('news-content-id', {
						toolbar : 'Full'
					});
				</script>
				<input type="submit" value="update news" />
			</div>
		</form>
		<%
			}
		%>
	</div>
	</div>
	<div id="blog" class="sec">
	<h3>Latest Blogs:</h3>
	<div id="blogs" class="section">
		Fetch latest entries from Blogs!!<br />
	</div>
	</div>
	<div id="comment" class="sec">
	<h3>Latest Comments:</h3>
	<div id="comment_sec" class="section">
		Fetch latest comments from Blogs' Entries!!<br />
	</div>
	</div>
	</div>
	
    <%@ include file="footer_inc.jsp" %>
	</div><!-- end wrapper div -->
</body>
</html>